package cn.chengpengper.shortlink.util;

import org.apache.shardingsphere.core.strategy.keygen.SnowflakeShardingKeyGenerator;

/**
 * @author huchengpeng
 * @version v1.0.0
 * @date 2023/9/3 21:24
 * @description ID生成器
 */
public class IdUtil {
    private static SnowflakeShardingKeyGenerator shardingKeyGenerator = new SnowflakeShardingKeyGenerator();

    public static Long genSnowFlakeId() {
        Comparable<?> id = shardingKeyGenerator.generateKey();
        return Long.parseLong(id.toString());
    }
}
